package com.zretc.entity;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component(value = "dept")
public class Dept {
	
	//@Value如果写在deptid
	//属性前，不会走setter方法
	@Value("1")
	private int deptid;
	private String deptName;
	
	
	
	@Override
	public String toString() {
		return "Dept [deptid=" + deptid + ", deptName=" + deptName + "]";
	}
	/**
	 * @return the deptid
	 */
	public int getDeptid() {
		return deptid;
	}
	/**
	 * @param deptid the deptid to set
	 */
	public void setDeptid(int deptid) {
		System.out.println("setDeptid 方法");
		this.deptid = deptid;
	}
	/**
	 * @return the deptName
	 */
	public String getDeptName() {
		return deptName;
	}
	/**
	 * @param deptName the deptName to set
	 * 如果@Value写在setter方法前，明确了，要调用这个set方法；
	 */
	@Value("测试部门")
	public void setDeptName(String deptName) {
		System.out.println("setDeptName 方法");
		this.deptName = deptName;
	}
	
	

}
